<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>我发布的商品</title>
    <include file="Pub:style" />
</head>
<body>
    <volist name="list" id="vo">
        <div class="row" style="margin:5px;">
            <div class="col-xs-12" style="box-shadow: darkgrey 1px 2px 5px 0px;">
                <div>
                    <div class="usergoodsbox-top">
                        <div class="img"></div>
                        <div class="text">
                            <h3><#$vo.g_name#></h3>
                            <p>￥&nbsp;<#$vo.g_price#></p>
                            <p><#$vo.g_state#></p>
                        </div>
                    </div>
                    <div class="usergoodsbox-footer">
                        <button onclick="cancelfabu('<#$vo.id#>')">取消发布</button>
                        <button onclick="lookwords('<#$vo.id#>')">查看留言</button>
                    </div>
                </div>
            </div>
        </div>
    </volist>
</body>
<script>
    // 取消发布
    function cancelfabu(gid){
        $.ajax({
            url:"<#:U('Goods/cancelfabu')#>",
            async:true,
            type:'post',
            data:{gid:gid},
            dataType:'json',
            success:function(res){
                if(res.code==100){
                    document.location.reload();
                    layer.msg("取消成功");
                }else{
                    layer.msg("操作失败，请再次尝试");
                }
            },error:function(res){
                console.log(res)
            }
        })
    }
    // 查看留言
    function lookwords(gid){
        document.location.href="__MODULE__/Words/index?gid="+gid;
    }
</script>
</html>